import mockApi from "@/api/mockApi";
import type {JobDescriptionForm} from '@/types/req/jobDescriptionForm'
import type {JobDescriptionQueryForm} from '@/types/req/jobDescriptionQueryForm'
import type {JobDescription} from '@/types/resp/jobDescription'
import type {Response} from '@/types/response'
import type {Result} from '@/types/result'
import type {Page} from "@/types/page";

export default class jobDescriptionApi {
  static jobDescriptions: JobDescription[] = [
    {"id":1,"enterpriseId":3,"enterpriseName":"江洋科技","jobTitle":"前端开发工程师","departmentId":3,"departmentName":"技术研发部","workLocation":"深圳","jobType":10,"responsibilities":"负责公司产品的前端开发与维护，参与需求分析与技术方案设计。","requirement":"1. 本科及以上学历，计算机相关专业；\n2. 熟悉HTML/CSS/JavaScript，有Vue或React开发经验；\n3. 具备良好的沟通能力和团队协作精神。","salaryRange":1,"postingDate":"2024-12-11","closingDate":"2024-03-22","headCount":1,"status":10,"createTime":"2024-04-06 22:43:13","modifyTime":"2024-11-21 22:43:13"},
    {"id":2,"enterpriseId":3,"enterpriseName":"快讯科技","jobTitle":"产品经理","departmentId":2,"departmentName":"产品部","workLocation":"北京","jobType":10,"responsibilities":"负责产品的规划与设计，协调开发团队完成产品迭代。","requirement":"1. 本科及以上学历，3年以上产品经理经验；\n2. 熟悉产品设计工具，如Axure、Sketch等；\n3. 具备较强的市场分析和用户需求挖掘能力。","salaryRange":3,"postingDate":"2024-05-03","closingDate":"2024-07-02","headCount":4,"status":10,"createTime":"2024-01-20 22:43:13","modifyTime":"2024-08-06 22:43:13"},
    {"id":3,"enterpriseId":1,"enterpriseName":"阿里妈妈","jobTitle":"数据分析师","departmentId":4,"departmentName":"数据科学部","workLocation":"杭州","jobType":30,"responsibilities":"负责公司业务数据的分析与挖掘，提供数据支持与决策建议。","requirement":"1. 硕士及以上学历，数学、统计学或计算机相关专业；\n2. 熟练使用SQL、Python等数据分析工具；\n3. 具备良好的逻辑思维和数据分析能力。","salaryRange":1,"postingDate":"2024-12-19","closingDate":"2024-10-02","headCount":3,"status":10,"createTime":"2024-07-20 22:43:13","modifyTime":"2024-01-22 22:43:13"},
    {"id":4,"enterpriseId":2,"enterpriseName":"华元技术","jobTitle":"云计算工程师","departmentId":3,"departmentName":"云服务部","workLocation":"深圳","jobType":10,"responsibilities":"负责云计算平台的开发与维护，解决技术难题。","requirement":"1. 本科及以上学历，计算机相关专业；\n2. 熟悉Linux系统及云计算相关技术；\n3. 有Kubernetes、Docker等容器技术经验者优先。","salaryRange":1,"postingDate":"2025-01-05","closingDate":"2024-02-04","headCount":4,"status":10,"createTime":"2024-05-12 22:43:13","modifyTime":"2024-05-17 22:43:13"},
    {"id":5,"enterpriseId":1,"enterpriseName":"阿里八八","jobTitle":"UI设计师","departmentId":2,"departmentName":"设计部","workLocation":"杭州","jobType":10,"responsibilities":"负责公司产品的界面设计与用户体验优化。","requirement":"1. 本科及以上学历，设计相关专业；\n2. 熟练使用Sketch、Figma等设计工具；\n3. 具备良好的审美能力和创新意识。","salaryRange":4,"postingDate":"2024-08-29","closingDate":"2024-04-21","headCount":2,"status":10,"createTime":"2024-03-28 22:43:13","modifyTime":"2024-12-29 22:43:13"},
    {"id":6,"enterpriseId":1,"enterpriseName":"永久科技","jobTitle":"Java开发工程师","departmentId":3,"departmentName":"技术研发部","workLocation":"杭州","jobType":10,"responsibilities":"负责公司后端系统的开发与维护，参与架构设计与优化。","requirement":"1. 本科及以上学历，计算机相关专业；\n2. 熟悉Java开发，有Spring框架经验；\n3. 具备良好的代码规范和团队协作能力。","salaryRange":5,"postingDate":"2024-07-22","closingDate":"2024-12-15","headCount":3,"status":20,"createTime":"2024-06-24 22:43:13","modifyTime":"2024-05-20 22:43:13"},
    {"id":7,"enterpriseId":1,"enterpriseName":"快递咨询","jobTitle":"测试工程师","departmentId":2,"departmentName":"质量保障部","workLocation":"杭州","jobType":30,"responsibilities":"负责公司产品的测试工作，编写测试用例并执行测试。","requirement":"1. 本科及以上学历，计算机相关专业；\n2. 熟悉测试流程与工具，如JIRA、Selenium等；\n3. 具备良好的问题分析和解决能力。","salaryRange":5,"postingDate":"2024-06-13","closingDate":"2024-12-06","headCount":4,"status":10,"createTime":"2024-04-23 22:43:13","modifyTime":"2024-04-14 22:43:13"}
  ];

  static async save (jobDescriptionForm: JobDescriptionForm): Promise<Result<void>> {
    console.log('jobDescriptionApi save params', jobDescriptionForm)
    const response: Response<void> = await mockApi.operateSuccessfully()
    return response.data
  }

  static async find (jobDescriptionQueryForm: JobDescriptionQueryForm): Promise<Result<Page<JobDescription>>> {
    console.log('jobDescriptionApi find params', jobDescriptionQueryForm)
    const response: Response<Page<object>> = await mockApi.queryPageSuccessfully(jobDescriptionApi.jobDescriptions)
    return response.data
  }

  static async findById (id: number): Promise<Result<JobDescription>> {
    console.log('jobDescriptionApi findById id', id)
    let target = {}
    for (const a of jobDescriptionApi.jobDescriptions) {
      if (a.id === id) {
        target = a
      }
    }
    const response: Response<JobDescription> = await mockApi.operateSuccessfullyWithData(target)
    return response.data
  }

  static async del (id: number): Promise<Result<void>> {
    console.log('jobDescriptionApi del id', id)
    const response: Response<void> = await mockApi.operateSuccessfully()
    return response.data
  }
}